package com.vpx.server.controller.system;

/**
 * @author liuks
 * @title: vpx
 * @module: TODO
 * @description: TODO
 * @date 2021/09/20 18:31
 */

import com.vpx.server.bean.order.base.BaseIdOrder;
import com.vpx.server.bean.order.system.*;
import com.vpx.server.bean.result.system.*;
import com.vpx.server.framework.authority.AuthPoicy;
import com.vpx.server.framework.authority.RequestAuth;
import com.vpx.server.framework.base.ResultMsg;
import com.vpx.server.service.system.SysDicValueService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author liuks
 * @title: vpx
 * @module: 数据字典
 * @description: 数据字典
 * @date 2021/09/20 17:28
 */
@RestController
@RequestMapping(value = "/api/dicValue")
@Api(tags = "数据字典")
public class SysDicValueController {

    @Autowired
    private SysDicValueService sysDicValueService;

    @PostMapping("insert")
    @ApiOperation("新增数据字典")
    @RequestAuth(poicy = AuthPoicy.LOGIN)
    public ResultMsg insert(@RequestBody SysDicValueOrder order) {
        return sysDicValueService.insert(order);
    }

    @DeleteMapping("deleteById")
    @ApiOperation("删除数据字典")
    @RequestAuth(poicy = AuthPoicy.LOGIN)
    public ResultMsg deleteById(@RequestBody BaseIdOrder order) {
        return sysDicValueService.deleteById(order);
    }

    @PutMapping("updateById")
    @ApiOperation("修改数据字典")
    @RequestAuth(poicy = AuthPoicy.LOGIN)
    public ResultMsg updateById(@RequestBody SysDicValueOrder order) {
        return sysDicValueService.updateById(order);
    }

    @GetMapping("findById")
    @ApiOperation("查询数据字典")
    @RequestAuth(poicy = AuthPoicy.LOGIN)
    public ResultMsg<SysDicValueResult> findById(BaseIdOrder order) {
        return sysDicValueService.findById(order);
    }

    @GetMapping("pageQuery")
    @ApiOperation("分页查询数据字典")
    @RequestAuth(poicy = AuthPoicy.LOGIN)
    public ResultMsg<SysDicValuePageResult> pageQuer(SysDicValuePageOrder order) {
        return sysDicValueService.pageQuery(order);
    }

    @GetMapping("findList")
    @ApiOperation("查询数据字典列表")
    @RequestAuth(poicy = AuthPoicy.LOGIN)
    public ResultMsg<SysDicValueListResult> findList(SysDicValueCodeOrder order) {
        return sysDicValueService.findListByTypeCode(order);
    }

}
